function pageLoad() {
    var txt = $get('textInput');
    if(txt) {
        $addHandler(txt, 'keyup', showLetter);
    }
}

function showLetter(eventInfo) {
    alert(eventInfo.keyCode);
}

function testGet() {
    alert($get('main').innerHTML);
}

function testAddHandler() {
    var button = $get('mainButton');
    if(button) {
        $addHandler(button, 'click', buttonClickHandler);
    }
}

function testRemoveHandler() {
    var button = $get('mainButton');
    if(button) {
        $removeHandler(button, 'click', buttonClickHandler);
    }
}

function testClearHandlers() {
    var button = $get('mainButton');
    if(button) {
        $clearHandlers(button);
    }
}

function testAddMouseOverHandler() {
    var button = $get('mainButton');
    if(button) {
        $addHandler(button, 'mouseover', buttonMouseOverHandler);
        $addHandler(button, 'mouseout', buttonMouseOutHandler);
    }
}

function buttonClickHandler(sender) {
    alert('I was added to the button click');
}

function buttonMouseOverHandler(sender) {
    var button = $get('mainButton');
    if(button) {
        //long version, but nicer code to read
        var borderCss = button.currentStyle.borderWidth;
        var size = new Number(borderCss.replace('px',''));
        size += 5;
        button.style.borderWidth = size + 'px';
    }
}

function buttonMouseOutHandler(sender) {
    //short version - works but not nice to read
    var size = new Number(sender.target.currentStyle.borderWidth.replace('px',''));
    size -= 5;
    sender.target.style.borderWidth = size.toString() + 'px';
}

//this example was original created.derived from a sample on the asp.net
//site
//http://www.asp.net/AJAX/Documentation/Live/ClientReference/Sys.UI/DomEventClass/DomEventAddHandlersMethod.aspx
function testAddHandlers() {
    var button = $get('handlerButton');
    if(button) {
        var events = {click:showEvent, mousedown:showEvent, mouseup:showEvent, mouseover:showEvent, mouseout:showEvent};
        $addHandlers(button, events);
    }
}

function showEvent(sender) {
    sender.target.value = sender.type.toString();
}
